#pragma once
#include "stdafx.h"
#include "Types.h"
#include <boost/noncopyable.hpp>
static const std::string SERVER_IP = "localhost";
static const std::string SERVER_PORT = "8081";
//register schema command example
//{
//	"command_type":"register_schema",
//	"schema_content":{...}
//	"input_specification":{"input_type":"random_generated"}   
//}
//{
//	"command_type":"register_schema",
//	"schema_content":{...}
//	"input_specification":{"input_type":"socket_input",
//                         "input_ip":"localhost",
//                         "input_port":"8080"
//                        }   
//}
//input_specification may be one of random_generated,socket_input
//schema_content is explained by JsonSchema class

//register query command example
//{
// "command_type":"register_query",
// "query_content":{...},
// "output_specification":{"output_type":"show_result"}
//}
//{
// "command_type":"register_query",
// "query_content":{...},
// "output_specification":{"output_type":"socket_output",
//                         "output_ip":"localhost",
//                         "output_port":"8080"
//                        }
//}
//output_specification may be one of show_result,socket_output
//query_content is explained by QueryIntermediateRepresentation class
const static std::string COMMAND_TYPE = "command_type";
const static std::string REGISTER_QUERY = "register_query";
const static std::string REGISTER_SCHEMA = "register_schema";
const static std::string SCHEMA_CONTENT = "schema_content";
const static std::string INPUT_SPECIFICATION = "input_specification";
const static std::string INPUT_TYPE = "input_type";
const static std::string RANDOM_GENERATED = "random_generated";
const static std::string SOCKET_INPUT = "socket_input";
const static std::string INPUT_IP = "input_ip";
const static std::string INPUT_PORT = "input_port";
const static std::string QUERY_CONTENT = "query_content";
const static std::string OUTPUT_SPECIFICATION = "output_specification";
const static std::string OUTPUT_TYPE = "output_type";
const static std::string SHOW_RESULT = "show_result";
const static std::string SOCKET_OUTPUT = "socket_output";
const static std::string OUTPUT_IP = "output_ip";
const static std::string OUTPUT_PORT = "output_port";

class CommandManager:private boost::noncopyable
{
private:
	static CommandManager* commandManager;
	CommandManager(void);
	void initial(void);
	bool processRegisterSchemaCommand(Document& document);
	bool processRegisterQueryCommand(Document& document);
public:
	static CommandManager* getInstance();
	~CommandManager(void);
	bool processCommand(char* command,size_t length);
};

